		
/* ************************************************************************************* 
 * CREATED BY:          MYGENERATION
 * CREATED DATE:        1/16/2009
 * PROJECT:             MCWEBSITE
 * PURPOSE:             websiteResourceBUL class
 * MODIFIED BY:         None
 * MODIFIED DATE:       None
 * MODIFIED REASON:     None
 * NOTES:               None
 **************************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using MCWEBSITE.DAL;
using MCWEBSITE.ENTITY;

namespace MCWEBSITE.BUL
{
    public class websiteResourceBUL
    {
        public static int Save(websiteResourceInfo _websiteResourceInfo)
        {
            try
            {
                if (_websiteResourceInfo.ResourceID == 0)
                {
                    return websiteResourceDAL.Insert(_websiteResourceInfo);
                }
                else
                {
                    return websiteResourceDAL.Update(_websiteResourceInfo);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Error on insert theme : {0}", ex.Message));
            }
        }

        public static int publish(int ID)
        {
            try
            {
                return websiteResourceDAL.publish(ID);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Error on insert theme : {0}", ex.Message));
            }
        }

        public static int unpublish(int ID)
        {
            try
            {
                return websiteResourceDAL.unpublish(ID);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Error on insert theme : {0}", ex.Message));
            }
        }

        public static int Remove(int _ResourceID)
        {
            try
            {
                return websiteResourceDAL.Delete(_ResourceID);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Error on delete Theme : {0}", ex.Message));
            }
        }

        public static List<websiteResourceInfo> GetAll()
        {
            try
            {
                return websiteResourceDAL.SelectAll();
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Error:{0}", ex.Message));
            }
        }

        public static List<websiteResourceInfo> GetByLanguage(string status, string LanguageCode)
        {
            try
            {
                return websiteResourceDAL.SelectByLanguage(status, LanguageCode);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Error:{0}", ex.Message));
            }
        }

        public static List<websiteResourceInfo> GetByStatus(string status)
        {
            try
            {
                return websiteResourceDAL.GetByStatus(status);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Error:{0}", ex.Message));
            }
        }
        public static websiteResourceInfo Load(int _ResourceID)
        {
            try
            {
                return websiteResourceDAL.SelectOne(_ResourceID);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Error:{0}", ex.Message));
            }
        }

        public static List<websiteResourceInfo> Search()
        {
            try
            {
                return websiteResourceDAL.SelectFilters();
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Error:{0}", ex.Message));
            }
        }
        public static int InsertResource(int NewsId, string Resources)
        {
            try
            {
                return websiteResourceDAL.InsertResource(NewsId, Resources);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Error:{0}", ex.Message));
            }
        }
    }
}

		